﻿<navfx:Page x:Class="NavFx.NavFxDemoVB.PanelPage1"
			xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			xmlns:navfx="clr-namespace:NavFx;assembly=NavFx"
			HorizontalAlignment="Stretch"
			VerticalAlignment="Stretch">
	<navfx:Page.Resources>
		<Style x:Key="headingText"
			   TargetType="TextBlock">
			<Setter Property="Margin"
					Value="10,5,10,5" />
			<Setter Property="FontSize"
					Value="15" />
			<Setter Property="FontWeight"
					Value="Bold" />
		</Style>
		<Style x:Key="paragraphText"
			   TargetType="TextBlock">
			<Setter Property="Margin"
					Value="5" />
			<Setter Property="FontSize"
					Value="12" />
			<Setter Property="TextWrapping"
					Value="Wrap" />
		</Style>
	</navfx:Page.Resources>

	<!-- main layout grid-->
	<Grid x:Name="pageLayout"
		  HorizontalAlignment="Stretch"
		  VerticalAlignment="Stretch">

		<Grid.ColumnDefinitions>
			<ColumnDefinition />
		</Grid.ColumnDefinitions>


		<Grid.RowDefinitions>
			<RowDefinition Height="50" />
			<RowDefinition />
		</Grid.RowDefinitions>

		<TextBlock Grid.Column="0"
				   Grid.Row="0"
				   Style="{StaticResource headingText}"
				   Text="External Page 1" />

		<Grid HorizontalAlignment="Stretch"
			  VerticalAlignment="Top"
			  Grid.Column="0"
			  Grid.Row="1">

			<Grid.ColumnDefinitions>
				<ColumnDefinition />
			</Grid.ColumnDefinitions>

			<Grid.RowDefinitions>
				<RowDefinition />
				<RowDefinition />
				<RowDefinition />
				<RowDefinition />
				<RowDefinition />
				<RowDefinition />
				<RowDefinition />
			</Grid.RowDefinitions>

			<TextBlock Style="{StaticResource paragraphText}"
					   Grid.Column="0"
					   Grid.Row="0">
					This page has been loaded from a library external to the main application.
			</TextBlock>

			<TextBlock Style="{StaticResource paragraphText}"
					   Grid.Column="0"
					   Grid.Row="1">
				There are two pages in the library.  This one PanelPage1 and another PanelPage2, you can see this in the Registered Pages list.
				Both of these pages inherit from NavFx.Page and demonstrate the loading of simple content pages from an external library.
			</TextBlock>

			<TextBlock Style="{StaticResource paragraphText}"
					   Grid.Column="0"
					   Grid.Row="2">		
					Navigator provides three overrides of the GoToPage method.
			</TextBlock>

			<TextBlock Style="{StaticResource paragraphText}"
					   Grid.Column="0"
					   Grid.Row="3">			
				GoToPage(string path) - is the simplest of the overloads, it expects the target page to be registered.  If the page is
				not registered a PageNotRegisteredException is thrown. You would typically use this overload to load pages that
				are within the main application package and you have registered with the RegisterPage method.  You can also use it
				to display pages that have been loaded from external libraries using the LoadPages method.
			</TextBlock>

			<TextBlock Style="{StaticResource paragraphText}"
					   Grid.Column="0"
					   Grid.Row="4">			
				GoToPage(string path, bool updateIndex) - is an overload that also expects the target page to be registered.  If the page is
				not registered a PageNotRegisteredException is thrown. The difference between this overload and the previous one is that you
				have control over whether the CurrentIndex property is updated when the page is loaded. The previous overload actually calls
				this one passing false for the second argument.  If you plan to use the NextPage or PreviousPage methods in your application
				then you need to use this overload passing true for the updateIndex argument to ensure that the CurrentIndex pointer remains
				consistent. Maintaining the CurrentIndex has a performance overhead, which is why the default is not to. You can always check
				whether the CurrentIndex is consistent with the current page by checking the IsIndexConsistent property of the Navigator.
			</TextBlock>

			<TextBlock Style="{StaticResource paragraphText}"
					   Grid.Column="0"
					   Grid.Row="5">			
				GoToPage(string path, bool updateIndex, Uri libraryUri) - is an overload that is specifically designed for use with pages
				in external libraries.  The third argument allows you to pass in a relative url for a dll containing the target page.  If the
				page is already loaded it will be displayed from cache, if not it will be loaded from the libraryUri, added to the cache and
				then displayed.
			</TextBlock>

			<TextBlock Style="{StaticResource paragraphText}"
					   Grid.Column="0"
					   Grid.Row="6">			
				GoToPage(string path, bool updateIndex, string libraryUrl) - is an overload that saves you having to create a Uri instance,
				it does this for you based on the string url passed as libraryUrl.  After constructing the Uri it calls the previous overload.
			</TextBlock>

		</Grid>
	</Grid>
</navfx:Page>
